package ca.etsmtl.log730.projet.model.workspace;

import java.util.Vector;

import ca.etsmtl.log730.projet.model.LockInfo;
import ca.etsmtl.log730.projet.model.LockableObjectListener;
import ca.etsmtl.log730.projet.model.RessourceObject;

public class TextObject implements RessourceObject<StringBuffer> {
	/**
	 * 
	 */
	private static final long serialVersionUID = -7278380654199803324L;

	private Vector<LockableObjectListener<StringBuffer>> listener = new Vector<LockableObjectListener<StringBuffer>> ();
	
	private StringBuffer data = new StringBuffer();

	public StringBuffer getData() {
		return data;
	}

	public void setData(StringBuffer data) {
		this.data = data;
		for(LockableObjectListener<StringBuffer> lol: listener) {
			lol.dataChanged(data);
		}
	}
	
	
	private LockInfo lockInfo = LockInfo.get(true, true);

	public void setLockInfo(LockInfo li) {
		lockInfo = li;
		for(LockableObjectListener<StringBuffer> lol: listener) {
			lol.lockStatusChanged(li);
		}
	}
	@Override
	public LockInfo getLockInfo() {
		return lockInfo;
	}

	private String name = "";
	@Override
	public String getName() {
		return name;
	}

	
	public void setName(String n) {
		name = n;
	}


}
